package com.itheima.project_cloth.service.impl;

import com.itheima.project_cloth.mapper.OrderConsumerMapper;
import com.itheima.project_cloth.pojo.OrderConsumer;
import com.itheima.project_cloth.service.OrderConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class OrderConsumerServiceImpl implements OrderConsumerService {
    @Autowired
    private OrderConsumerMapper orderConsumerMapper;

    @Override
    public List<OrderConsumer> SelectOrderConsumerByTime(LocalDateTime time,String phoneNumber, String address, String price) {

        return orderConsumerMapper.SelectOrderConsumerByTime(time, phoneNumber, address, price);
    }


    @Override
    public void InsertOrderConsumer(OrderConsumer orderConsumer) {

        orderConsumer.setBeginTime(LocalDateTime.now());
        orderConsumer.setFinishTime(LocalDateTime.now());
        orderConsumerMapper.InsertOrderConsumer(orderConsumer);

    }



    @Override
    public void DeleteOrderConsumerById(List<Integer> id) {
        orderConsumerMapper.DeleteOrderConsumerById(id);
    }

    @Override
    public OrderConsumer UpdateOrderConsumerByIdselect(Integer id) {
        OrderConsumer orderConsumer= orderConsumerMapper.UpdateOrderConsumerByIdselect(id);
        return orderConsumer;
    }

    @Override
    public void UpdateOrderConsumerById(OrderConsumer orderConsumer) {
        orderConsumerMapper.UpdateOrderConsumerById();

    }

    @Override
    public OrderConsumer SelectOrderConsumerByName(String name) {
        OrderConsumer oc = orderConsumerMapper.SelectOrderConsumerByName(name);
        return oc;
    }

    @Override
    public List<OrderConsumer> SelectOrderConsumerByConsumer(Integer consumerId) {
        return orderConsumerMapper.list(consumerId);
    }

    @Override
    public List<OrderConsumer> SelectOrderConsumerByAddress(String address) {
        return orderConsumerMapper.listAddress(address);
    }


    @Override
    public OrderConsumer select(String name) {
        OrderConsumer ocon = orderConsumerMapper.select(name);
        return ocon;
    }

    @Override
    public void update(OrderConsumer orderConsumer) {
        orderConsumerMapper.update(orderConsumer);

    }

}
